package com.taotao.order.configration;

/**
 * Created by zhang_xming on 2017/3/3.
 */

import com.taotao.order.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyWebAppConfigurer
        extends WebMvcConfigurerAdapter {

    public void addInterceptors(InterceptorRegistry registry) {
        // 多个拦截器组成一个拦截器链
        // addPathPatterns 用于添加拦截规则
        // excludePathPatterns 用户排除拦截
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/order/**");
        super.addInterceptors(registry);
    }
//    @Bean
//    public UserFeignClient printBean(){
//        UserFeignClient userService = (UserFeignClient) SpringContextUtil.getBean("userFeignClient");
//        System.out.println(userService);
//        return userService;
//    }
}